package com.yonyou.cyxdms.sysAuth.service.dto;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yonyou.cyx.framework.bean.entity.base.BasePO;
import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.yonyou.cyx.function.utils.jsonserializer.localdatetime.JsonLocalDateTimeDeserializer;
import com.yonyou.cyx.function.utils.jsonserializer.localdatetime.JsonLocalDateTimeSerializer;
import com.yonyou.cyxdms.framework.bean.dto.base.DMSBaseDTO;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;


/**
 * <p>
 *
 * </p>
 *
 * @author quankk
 * @since 2019-05-16
 */

public class SmsLogDTO extends DMSBaseDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    private Integer id;
    private String dealerName;
    /**
     * 客户编号
     */
    private String cid;
    /**
     * 短信内容
     */
    private String content;
    /**
     * 手机号
     */
    private String mobile;
    /**
     * 请求地址
     */
    private String url;
    /**
     * 返回结果
     */
    private String returnMessage;
    /**
     * 验证码
     */
    private String checkCode;
    /**
     * 1：注册，2：登录，3：忘记密码
     */
    private BigDecimal smsType;
    /**
     * 最后校验时间
     */
    @JsonDeserialize(using = JsonLocalDateTimeDeserializer.class)
    @JsonSerialize(using = JsonLocalDateTimeSerializer.class)
    private LocalDateTime lastCheckTime;
    /**
     * 错误次数
     */
    private Integer errorCount;

    public SmsLogDTO() {
        super();
    }


    public Integer getId() {
        return id;
    }


    public void setId(Integer id) {
        this.id = id;
    }


    public String getDealerName() {
        return dealerName;
    }


    public void setDealerName(String dealerName) {
        this.dealerName = dealerName;
    }


    public String getCid() {
        return cid;
    }


    public void setCid(String cid) {
        this.cid = cid;
    }


    public String getContent() {
        return content;
    }


    public void setContent(String content) {
        this.content = content;
    }


    public String getMobile() {
        return mobile;
    }


    public void setMobile(String mobile) {
        this.mobile = mobile;
    }


    public String getUrl() {
        return url;
    }


    public void setUrl(String url) {
        this.url = url;
    }


    public String getReturnMessage() {
        return returnMessage;
    }


    public void setReturnMessage(String returnMessage) {
        this.returnMessage = returnMessage;
    }


    public String getCheckCode() {
        return checkCode;
    }


    public void setCheckCode(String checkCode) {
        this.checkCode = checkCode;
    }


    public BigDecimal getSmsType() {
        return smsType;
    }


    public void setSmsType(BigDecimal smsType) {
        this.smsType = smsType;
    }


    public LocalDateTime getLastCheckTime() {
        return lastCheckTime;
    }


    public void setLastCheckTime(LocalDateTime lastCheckTime) {
        this.lastCheckTime = lastCheckTime;
    }


    public Integer getErrorCount() {
        return errorCount;
    }


    public void setErrorCount(Integer errorCount) {
        this.errorCount = errorCount;
    }


    @Override
    public String toString() {
        return "SmsLogDTO{" +
                "id=" + id +
                ", dealerName=" + dealerName +
                ", cid=" + cid +
                ", content=" + content +
                ", mobile=" + mobile +
                ", url=" + url +
                ", returnMessage=" + returnMessage +
                ", checkCode=" + checkCode +
                ", smsType=" + smsType +
                ", lastCheckTime=" + lastCheckTime +
                ", errorCount=" + errorCount +
                "}";
    }

    /**
     * 将DTO 转换为PO
     * //对某个对象属性进行赋值
     * //BeanMapperUtil.populateValueByMethod(transPO,"setXxx",this.getXxx);
     *
     * @param poClass dto 需要转换的dto
     * @author quankk
     * @since 2018/7/22 0022
     */
    @Override
    public <T extends BasePO> T transDtoToPo(Class<T> poClass) {
        return super.transDtoToPo(poClass);
    }

    /**
     * 将DTO 转换为PO
     * BeanMapperUtil.populateValueByMethod(transPO,"setXxx",this.getXxx);
     *
     * @param po 需要转换的对象
     * @author quankk
     * @since 2018/7/22 0022
     */
    public <T extends BasePO> void transDtoToPo(T po) {
        BeanMapperUtil.copyProperties(this, po, "id");
    }

}
